<template>
  <el-popconfirm :title="title" @confirm="confirm">
    <template #reference>
      <el-link :type="type">
        <slot></slot>
      </el-link>
    </template>
  </el-popconfirm>
</template>

<script setup lang="ts">
defineOptions({
  name: 'a-link'
})

interface Props {
  confirm?: () => void
  title?: string
  type: 'default' | 'success' | 'warning' | 'info' | 'primary' | 'danger'
}

withDefaults(defineProps<Props>(), {
  confirm: () => {},
  title: '请确认当前操作',
  type: 'default'
})
</script>
